<!DOCTYPE html>
<html lang="en">
<head>
    <!--
      @author 陈周云
      @Description: 中央政府财政盈余占GDP比重
    -->
    <meta charset="UTF-8">
    <title>中央政府财政盈余占GDP比重</title>
    <!-- 引入Jquery -->
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>

    <!-- 引入Bootstrap -->
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

    <!-- 引入BootStrap-table -->
    <link rel="stylesheet" href="../assets/libs/bootstrap-table-master/dist/bootstrap-table.min.css">
    <script src="../assets/libs/bootstrap-table-master/dist/bootstrap-table.min.js"></script>

    <!-- 引入Bootstrap-paginator -->
    <script src="../assets/libs/bootstrap-paginator-master/build/bootstrap-paginator.min.js"></script>

    <!-- 引入Echarts -->
    <script src="../assets/libs/echarts/echarts.min.js"></script>
    <style>
        .th-inner{
            text-align:center;
        }
    </style>
</head>
<body>
    <div class="container">
        <div>
            <ul class="nav nav-tabs">
                <li role="presentation" id="tableTag"><a href="javascript:;" onclick="showTable()">&nbsp;<span class="glyphicon glyphicon-th-large"></span>&nbsp;</a></li>
                <li role="presentation" id="imageTag"><a href="javascript:;" onclick="showImage()">&nbsp;<span class="glyphicon glyphicon-tasks"></span>&nbsp;</a></li>
            </ul>
        </div>

        <div id="tableView">
            <div class="page-header" style="text-align: center;">
                <h3>中央政府财政盈余占GDP比重</h3>
                <br>
                <h4 style="margin-top: -20px;">Surplus of Central Government Revenue as Percentage of GDP</h4>
            </div>

            <div style="text-align: right;">单位:&nbsp;%</div>

            <table id="tableData"></table>
        </div>

        <div id="imageView">
            <div class="page-header" style="text-align: center;">
                <h3>中央政府财政盈余占GDP比重柱状图</h3>
                <br>
                <h4 style="margin-top: -20px;">Surplus of Central Government Revenue as Percentage of GDP</h4>
            </div>

            <div class="panel" style="margin-top:1.5em;">
            	<!--<div style="text-align: right;">单位:&nbsp;%</div>-->
                <div id="main" style="width: 100%;height:400px;"></div>
            </div>
        </div>

        <div style="color: #959595; margin-top: 1.5em;">*此数据仅展现最近五年，若需全部数据请点击&nbsp;<a href="#" class="btn btn-info btn-xs">
            <span class="glyphicon glyphicon-save"></span> 下载
        </a></div>


        <!-- <div style="text-align: right;"><div id="page"></div></div> -->
    </div>
    <script>
        $(function(){
            $('#imageView').hide();
            $('#tableTag').attr('class','active');
        })

        function showTable() {
            $('#tableView').show();
            $('#imageView').hide();
            $('#tableTag').attr('class','active');
            $('#imageTag').removeClass('active');
        }

        function showImage() {
            $('#imageView').show();
            $('#tableView').hide();
            $('#imageTag').attr('class','active');
            $('#tableTag').removeClass('active');
        }

        $('#tableData').bootstrapTable({
            striped: true,
            columns: [
                {
                    field: 'country',
                    title: '国家'
                },
                {
                    field: 'year1',
                    title: '2000年'
                },
                {
                    field: 'year2',
                    title: '2005年'
                },
                {
                    field: 'year3',
                    title: '2010年'
                },
                {
                    field: 'year4',
                    title: '2013年'
                },
                {
                    field: 'year5',
                    title: '2014年'
                },
            ],
            data: [
                {
                    country: "阿尔巴尼亚",
                    year1:"",
                    year2:"",
                    year3:"",
                    year4:"",
                    year5:"",
                },
                {
                    country: "爱沙尼亚",
                    year1:"-0.065457247",
                    year2:"0.002099687",
                    year3:"-0.002301406",
                    year4:"0.000336114",
                    year5:"",
                },
                {
                    country: "保加利亚",
                    year1:"-0.375733464",
                    year2:"3.139351202",
                    year3:"-3.315997274",
                    year4:"",
                    year5:"",
                },
                {
                    country: "波兰",
                    year1:"-3.014596438",
                    year2:"-5.073919791",
                    year3:"-6.569761809",
                    year4:"-3.803745726",
                    year5:"-1.617529867",
                },
                {
                    country: "黑山",
                    year1:"",
                    year2:"",
                    year3:"",
                    year4:"",
                    year5:"",
                },
                {
                    country: "捷克",
                    year1:"-3.311009302",
                    year2:"-3.412828594",
                    year3:"-4.548150558",
                    year4:"",
                    year5:"",
                },
                {
                    country: "克罗地亚",
                    year1:"-5.243920586",
                    year2:"-2.364660555",
                    year3:"-4.39938761",
                    year4:"",
                    year5:"",
                },
                {
                    country: "拉脱维亚",
                    year1:"-2.208163803",
                    year2:"-0.850678955",
                    year3:"-6.923704099",
                    year4:"",
                    year5:"",
                },
                {
                    country: "立陶宛",
                    year1:"-2.562631098",
                    year2:"-2.429088458",
                    year3:"-2.802666756",
                    year4:"-1.206882949",
                    year5:"0.026987702",
                },
                {
                    country: "罗马尼亚",
                    year1:"-5.699025254",
                    year2:"-3.000666419",
                    year3:"-6.830490909",
                    year4:"-2.362814061",
                    year5:"-0.664297503",
                },
                {
                    country: "马其顿",
                    year1:"",
                    year2:"2.322384738",
                    year3:"-2.531008745",
                    year4:"",
                    year5:"",
                },
                {
                    country: "塞尔维亚",
                    year1:"",
                    year2:"",
                    year3:"-3.762876897",
                    year4:"",
                    year5:"",
                },
                {
                    country: "斯洛伐克",
                    year1:"-0.312145176",
                    year2:"-4.429961057",
                    year3:"-6.663427999",
                    year4:"-2.3226282",
                    year5:"-1.024189767",
                },
                {
                    country: "斯洛文尼亚",
                    year1:"-1.07976508",
                    year2:"-1.461660432",
                    year3:"-5.382609571",
                    year4:"",
                    year5:"",
                },
                {
                    country: "匈牙利",
                    year1:"-4.893940913",
                    year2:"-9.011692324",
                    year3:"-3.71818106",
                    year4:"-4.964785471",
                    year5:"-2.63642264",
                },
                {
                    country: "波黑",
                    year1:"",
                    year2:"2.007625303",
                    year3:"-2.174853143",
                    year4:"-1.974903097",
                    year5:"-0.272847141",
                },
            ]
        });

        var all = {
            "data": [
                ['', '-0.065457247', '-0.375733464', '-3.014596438', '', '-3.311009302', '-5.243920586', '-2.208163803', '-2.562631098', '-5.699025254', '', '', '-0.312145176', '-1.07976508', '-4.893940913', ''],
                ['', '0.002099687', '3.139351202', '-5.073919791', '', '-3.412828594', '-2.364660555', '-0.850678955', '-2.429088458', '-3.000666419', '2.322384738', '', '-4.429961057', '-1.461660432', '-9.011692324', '2.007625303'],
                ['', '-0.002301406', '-3.315997274', '-6.569761809', '', '-4.548150558', '-4.39938761', '-6.923704099', '-2.802666756', '-6.830490909', '-2.531008745', '-3.762876897', '-6.663427999', '-5.382609571', '-3.71818106', '-2.174853143'],
                ['', '0.000336114', '', '-3.803745726', '', '', '', '', '-1.206882949', '-2.362814061', '', '', '-2.3226282', '', '-4.964785471', '-1.974903097'],
                ['', '', '', '-1.617529867', '', '', '', '', '0.026987702', '-0.664297503', '', '', '-1.024189767', '', '-2.63642264', '-0.272847141'],
            ],
            "countrys": ["阿尔巴尼亚","爱沙尼亚","保加利亚","波兰","黑山","捷克","克罗地亚","拉脱维亚","立陶宛","罗马尼亚","马其顿","塞尔维亚","斯洛伐克","斯洛文尼亚","匈牙利","波黑"],
            "years": ["2000年", "2005年", "2010年", "2013年", "2014年"]
        };

        var option = {
            timeline: {
                axisType: 'category',
                autoPlay: true,
                playInterval: 5000,
                data: all.years
            },
            options: [{
                tooltip: {
                    trigger: 'axis'
                },
                // toolbox: {
                //     show: true,
                //     orient: 'vertical',
                //     x: 'right',
                //     y: 'center'
                // },
                title:{
                    subtext:'数据来源'
                },
                calculable: true,
                grid: {
                    y: 50,
                    y2: 100
                },
                xAxis: [{
                    type: 'category',
                    axisLabel: {
                        interval: 0
                    },
                    data: all.countrys
                }],
                yAxis: [{
                    type: 'value',
                    name: '%'
                }],
                series: [{
                    name: '银行资本充足率',
                    type: 'bar',
                    data: all.data[0]
                }]
            },
                {
                    series: [{
                        data: all.data[1]
                    }]
                },
                {
                    series: [{
                        data: all.data[2]
                    }]
                },
                {
                    series: [{
                        data: all.data[3]
                    }]
                },
                {
                    series: [{
                        data: all.data[4]
                    }]
                },
                {
                    series: [{
                        data: all.data[5]
                    }]
                },
                {
                    series: [{
                        data: all.data[6]
                    }]
                },
                {
                    series: [{
                        data: all.data[7]
                    }]
                },
                {
                    series: [{
                        data: all.data[8]
                    }]
                }
            ]
        };
        var myChart = echarts.init(document.getElementById('main'));
        // 使用刚指定的配置项和数据显示图表。
        myChart.setOption(option);
    </script>
</body>
</html>